import 'dart:ffi';

import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_gprinter/flutter_gprinter.dart';
import 'package:flutter_gprinter/flutter_gprinter_platform_interface.dart';
import 'package:flutter_gprinter/flutter_gprinter_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockFlutterGprinterPlatform
    with MockPlatformInterfaceMixin
    implements FlutterGprinterPlatform {

  @override
  Future<String?> getPlatformVersion() => Future.value('42');

  @override
  void navUsbDevices() {
    // TODO: implement navUsbDevices
  }

  @override
  Future<bool?> print(cmds) {
    // TODO: implement print
    throw UnimplementedError();
  }

  @override
  void navBTDevices() {
    // TODO: implement navBTDevices
  }

  @override
  void autoConnect() {
    // TODO: implement autoConnect
  }

  @override
  void navWifiDevices() {
    // TODO: implement navWifiDevices
  }

  @override
  Future<bool> write(List<int> bytes) {
    // TODO: implement write
    throw UnimplementedError();
  }

  @override
  void connectBt(String macAddress) {
    // TODO: implement connectBt
  }

  @override
  void connectNet(String ipAddress) {
    // TODO: implement connectNet
  }

  @override
  void connectUSB(String pathName) {
    // TODO: implement connectUSB
  }

  @override
  void addMethodCallHandler(CallHandler handler) {
    // TODO: implement addMethodCallHandler
  }

  @override
  void disconnect() {
    // TODO: implement disconnect
  }

}

void main() {
  final FlutterGprinterPlatform initialPlatform = FlutterGprinterPlatform.instance;

  test('$MethodChannelFlutterGprinter is the default instance', () {
    expect(initialPlatform, isInstanceOf<MethodChannelFlutterGprinter>());
  });

  test('getPlatformVersion', () async {
    FlutterGprinter flutterGprinterPlugin = FlutterGprinter();
    MockFlutterGprinterPlatform fakePlatform = MockFlutterGprinterPlatform();
    FlutterGprinterPlatform.instance = fakePlatform;

    expect(await flutterGprinterPlugin.getPlatformVersion(), '42');
  });
}
